package com.dgut.hisystem.mapper;

import com.dgut.hisystem.entity.Case;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CaseMapper {
    @Select({"Select * from case_info where bl_id=#{id}"})
    Case selectID(long id);
    @Insert({"Insert into case_info(bl_pillness, bl_fillness, bl_allergy, bl_symptom, bl_assist, bl_diag, bl_suggestion, bl_change, bl_appointment, bl_consultation, br_card, ys_id) VALUES (#{bl_pillness}, #{bl_fillness}, #{bl_allergy}, #{bl_symptom}, #{bl_assist}, #{bl_diag}, #{bl_suggestion}, #{bl_change}, #{bl_appointment}, #{bl_consultation}, #{br_card}, #{ys_id})"})
    void insert(Case case1);
    @Select({"Select * from case_info where bl_consultation=#{bl_consultation}"})
    List<Case> selectCaseRecord(int bl_consultation);
    @Select({"Select * from case_info where bl_consultation=#{bl_consultation} and br_card like concat('%',#{br_card},'%')"})
    List<Case> selectCaseRecordByCard(int bl_consultation,long br_card);
    @Update({"UPDATE case_info set bl_pillness=#{case1.bl_pillness}, bl_fillness=#{case1.bl_fillness}, bl_allergy=#{case1.bl_allergy}, bl_symptom=#{case1.bl_symptom}, bl_assist=#{case1.bl_assist}, bl_diag=#{case1.bl_diag}, bl_suggestion=#{case1.bl_suggestion}, bl_change=#{case1.bl_change},  bl_consultation=#{case1.bl_consultation} where bl_id = #{id}"})
    void update(Case case1,long id);
}
